package com.ly.mp.dal.comm.mybatis;

import javax.sql.DataSource;

import org.apache.ibatis.session.TransactionIsolationLevel;
import org.apache.ibatis.transaction.Transaction;
import org.mybatis.spring.transaction.SpringManagedTransactionFactory;

public class MpSpringManagedTransactionFactory extends SpringManagedTransactionFactory {
    private String transactionPolicy;

    public MpSpringManagedTransactionFactory() {
    }

    public MpSpringManagedTransactionFactory(String transactionPolicy) {
        this.transactionPolicy = transactionPolicy;
    }

    @Override
    public Transaction newTransaction(DataSource dataSource, TransactionIsolationLevel level, boolean autoCommit) {
        return new MpSpringManagedTransaction(dataSource, this.transactionPolicy);
    }
}